package cn.tedu.submarine2;

import javax.swing.*;

/**
 * 图片类，海洋对象所对应的图片
 */
public class Images {

    /**
     * 各张图片的变量名
     */
    public static ImageIcon sea;
    public static ImageIcon gameover;
    public static ImageIcon battleship;
    public static ImageIcon obsersubm;
    public static ImageIcon torpesubm;
    public static ImageIcon minesubm;
    public static ImageIcon mine;
    public static ImageIcon bomb;

    // 静态代码块，将imgs下的图片读取到变量中
    static{
        sea = new ImageIcon("imgs/sea.png");
        gameover = new ImageIcon("imgs/gameover.png");
        battleship = new ImageIcon("imgs/battleship.png");
        obsersubm = new ImageIcon("imgs/obsersubm.png");
        torpesubm = new ImageIcon("imgs/torpesubm.png");
        minesubm = new ImageIcon("imgs/minesubm.png");
        mine = new ImageIcon("imgs/mine.png");
        bomb = new ImageIcon("imgs/bomb.png");
    }

    /**
     * 写一个方法，测试系统能不能读取到图片信息
     * 返回8表示图片读取成功，返回其余数字表示图片读取失败
     */
    public static void main(String[] args) {
        System.out.println(sea.getImageLoadStatus());
        System.out.println(gameover.getImageLoadStatus());
        System.out.println(battleship.getImageLoadStatus());
        System.out.println(obsersubm.getImageLoadStatus());
        System.out.println(torpesubm.getImageLoadStatus());
        System.out.println(minesubm.getImageLoadStatus());
        System.out.println(mine.getImageLoadStatus());
        System.out.println(bomb.getImageLoadStatus());
    }
}
